{
GtkCellRendererTextPrivate *priv;
GtkCellRendererText *celltext;
- GtkStyleContext *style_context;
- const PangoFontDescription *font_desc;
PangoLayout *layout;
PangoContext *context;
PangoFontMetrics *metrics;
celltext = GTK_CELL_RENDERER_TEXT (cell);
priv = celltext->priv;
- style_context = gtk_widget_get_style_context (widget);
-
gtk_cell_renderer_get_padding (cell, &xpad, NULL);
layout = get_layout (celltext, widget, NULL, 0);
/* Fetch the average size of a charachter */
context = pango_layout_get_context (layout);
- font_desc = gtk_style_context_get_font (style_context, 0);
- metrics = pango_context_get_metrics (context, font_desc,
+ metrics = pango_context_get_metrics (context,
+ pango_context_get_font_description (context),
pango_context_get_language (context));
char_width = pango_font_metrics_get_approximate_char_width (metrics);
gint font_size, arrow_size;
PangoContext *context;
PangoFontMetrics *metrics;
- const PangoFontDescription *font_desc;
GtkWidget *child;
gint minimum_width = 0, natural_width = 0;
gint child_min, child_nat;
- GtkStyleContext *style_context;
- GtkStateFlags state;
GtkBorder padding;
gfloat arrow_scaling;
"arrow-scaling", &arrow_scaling,
NULL);
- style_context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
-
get_widget_padding_and_border (widget, &padding);
- font_desc = gtk_style_context_get_font (style_context, state);
context = gtk_widget_get_pango_context (GTK_WIDGET (widget));
- metrics = pango_context_get_metrics (context, font_desc,
+ metrics = pango_context_get_metrics (context,
+ pango_context_get_font_description (context),
pango_context_get_language (context));
font_size = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
pango_font_metrics_get_descent (metrics));
PangoFontMetrics *metrics;
GtkBorder borders;
PangoContext *context;
- GtkStyleContext *style_context;
- GtkStateFlags state;
gint icon_widths = 0;
gint icon_width, i;
gint width;
context = gtk_widget_get_pango_context (widget);
- style_context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
-
metrics = pango_context_get_metrics (context,
- gtk_style_context_get_font (style_context, state),
+ pango_context_get_font_description (context),
pango_context_get_language (context));
_gtk_entry_get_borders (entry, &borders);
GtkEntryPrivate *priv = entry->priv;
PangoFontMetrics *metrics;
GtkBorder borders;
- GtkStyleContext *style_context;
- GtkStateFlags state;
PangoContext *context;
gint height;
PangoLayout *layout;
layout = gtk_entry_ensure_layout (entry, TRUE);
context = gtk_widget_get_pango_context (widget);
- style_context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
-
metrics = pango_context_get_metrics (context,
- gtk_style_context_get_font (style_context, state),
+ pango_context_get_font_description (context),
pango_context_get_language (context));
priv->ascent = pango_font_metrics_get_ascent (metrics);
GtkAdjustment *adjustment;
PangoContext *context;
PangoFontMetrics *metrics;
- GtkStyleContext *style_context;
- GtkStateFlags state;
GtkBorder borders;
gint x, layout_x;
gint char_width;
/* Approximate width of a char, so user can see what is ahead/behind */
context = gtk_widget_get_pango_context (widget);
- style_context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
metrics = pango_context_get_metrics (context,
- gtk_style_context_get_font (style_context, state),
+ pango_context_get_font_description (context),
pango_context_get_language (context));
char_width = pango_font_metrics_get_approximate_char_width (metrics) / PANGO_SCALE;
}
}
-static PangoFontMetrics *
-get_font_metrics (PangoContext *context, GtkWidget *widget)
-{
- GtkStyleContext *style_context;
- const PangoFontDescription *font;
- PangoFontMetrics *retval;
-
- style_context = gtk_widget_get_style_context (widget);
- font = gtk_style_context_get_font (style_context, GTK_STATE_FLAG_NORMAL);
-
- retval = pango_context_get_metrics (context,
- font,
- pango_context_get_language (context));
-
- return retval;
-}
-
/**
* gtk_label_get_measuring_layout:
* @label: the label
gint char_width, digit_width;
context = pango_layout_get_context (layout);
- metrics = get_font_metrics (context, GTK_WIDGET (label));
+ metrics = pango_context_get_metrics (context,
+ pango_context_get_font_description (context),
+ pango_context_get_language (context));
char_width = pango_font_metrics_get_approximate_char_width (metrics);
digit_width = pango_font_metrics_get_approximate_digit_width (metrics);
pango_font_metrics_unref (metrics);
gint *size,
gint *spacing)
{
- GtkStyleContext *style_context;
- GtkStateFlags state;
PangoContext *context;
PangoFontMetrics *metrics;
gfloat arrow_scaling;
*spacing = arrow_spacing;
context = gtk_widget_get_pango_context (child);
- style_context = gtk_widget_get_style_context (child);
- state = gtk_widget_get_state_flags (child);
metrics = pango_context_get_metrics (context,
- gtk_style_context_get_font (style_context, state),
+ pango_context_get_font_description (context),
pango_context_get_language (context));
*size = (PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
static gint
get_minimum_width (GtkWidget *widget)
{
- GtkStyleContext *style_context;
- GtkStateFlags state;
PangoContext *context;
PangoFontMetrics *metrics;
gint width;
gint width_chars;
context = gtk_widget_get_pango_context (widget);
- style_context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
metrics = pango_context_get_metrics (context,
- gtk_style_context_get_font (style_context, state),
+ pango_context_get_font_description (context),
pango_context_get_language (context));
width = pango_font_metrics_get_approximate_char_width (metrics);
if (priv->ellipsize)
{
- const PangoFontDescription *font_desc;
PangoContext *context;
PangoFontMetrics *metrics;
gint char_width;
/* The minimum size for ellipsized text is ~ 3 chars */
context = pango_layout_get_context (layout);
- font_desc = gtk_style_context_get_font (style_context, state);
- metrics = pango_context_get_metrics (context, font_desc, pango_context_get_language (context));
+ metrics = pango_context_get_metrics (context,
+ pango_context_get_font_description (context),
+ pango_context_get_language (context));
char_width = pango_font_metrics_get_approximate_char_width (metrics);
pango_font_metrics_unref (metrics);
{
PangoContext *context;
PangoFontMetrics *metrics;
- const PangoFontDescription *font_desc;
- GtkStyleContext *style_context;
- GtkStateFlags state;
gint char_width;
context = gtk_widget_get_pango_context (widget);
- style_context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
-
- font_desc = gtk_style_context_get_font (style_context, state);
- metrics = pango_context_get_metrics (context, font_desc,
+ metrics = pango_context_get_metrics (context,
+ pango_context_get_font_description (context),
pango_context_get_language (context));
char_width = pango_font_metrics_get_approximate_char_width (metrics);
pango_font_metrics_unref (metrics);